var $ = require('../../common/helper.js');
Page({
	data: {
		name1_selected: '',
		name2_selected: '',
		name3_selected: '',
		name4_selected: '',
		type:''
	},
	onLoad: function (options) {
		$.overload(false);
	},
	select: function (e) {
		var dataset = e.currentTarget.dataset;
		var data = this.data;
		for (var i = 1; i <= 4; i++) {
			if (Number(dataset.index) == i) {
				data['name' + dataset.index + '_selected'] = 'selected';
				data['type'] = dataset.name;
			} else {
				data['name' + i + '_selected'] = '';
			}
		}
		this.setData(data);
	},
	submit: function () {
		var apps = $.getApps(), app = apps[apps.length-2];
		app.selectType(this.data.type);
		wx.navigateBack();
	}
})